package com.health.user.service;


import com.baomidou.mybatisplus.extension.service.IService;
import com.health.api.model.transporter.TransporterRegisterRequest;
import com.health.common.model.user.LoginUser;
import com.health.common.model.vo.UserKeyVO;
import com.health.user.model.dto.doctor.DoctorRegisterRequest;
import com.health.user.model.dto.hospital.HospitalRegisterRequest;
import com.health.api.model.producer.ProducerRegisterRequest;
import com.health.user.model.dto.user.PatientRegisterRequest;
import com.health.user.model.entity.User;
import com.health.user.model.vo.LoginUserVO;
import com.health.user.model.vo.UserVO;
import jakarta.servlet.http.HttpServletRequest;
import org.fisco.bcos.sdk.v3.codec.ContractCodecException;
import org.fisco.bcos.sdk.v3.transaction.model.exception.TransactionBaseException;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 用户服务
 *
 * @author zhexueqi
 */
public interface UserService extends IService<User> {

    /**
     * 用户注册
     *
     * @param patientRegisterRequest
     * @return 新用户 id
     */
    @Transactional
    long patientRegister(PatientRegisterRequest patientRegisterRequest);


    /**
     * 用户注销
     *
     * @param request
     * @return
     */
    boolean userLogout(HttpServletRequest request);

    /**
     * 获取脱敏的已登录用户信息
     *
     * @return
     */
    LoginUserVO getLoginUserVO(HttpServletRequest request);

    /**
     * 获取脱敏的用户信息
     *
     * @param user
     * @return
     */
    UserVO getUserVO(User user);

    /**
     * 获取脱敏的用户信息
     *
     * @param userList
     * @return
     */
    List<UserVO> getUserVO(List<User> userList);


    /**
     * 用户生成自己的公私钥对
     * @param request
     * @return
     */
    UserKeyVO generateKey(HttpServletRequest request) throws TransactionBaseException, ContractCodecException;

    LoginUser getUserInfoByUserAccountAndPassword(String userAccount, String userPassword, Integer userRole);

    long hospitalRegister(HospitalRegisterRequest hospitalRegisterRequest);

    UserKeyVO doctorRegister(DoctorRegisterRequest doctorRegisterRequest) throws TransactionBaseException, ContractCodecException;

    List<String> getRoleList(Long loginId);

    long producerRegister(ProducerRegisterRequest producerRegisterRequest);

    Long transportRegister(TransporterRegisterRequest transportRegisterRequest);
}
